package com.usian.comment.controller.v1;

import com.usian.apis.comment.ApCommentControllerApi;
import com.usian.comment.service.ApCommentService;
import com.usian.model.comment.dtos.CommentDto;
import com.usian.model.comment.dtos.CommentLikeDto;
import com.usian.model.comment.dtos.CommentSaveDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v1/comment")
public class ApCommentController implements ApCommentControllerApi {

    @Autowired
    private ApCommentService apCommentServiceI;
    @PostMapping("save")
    @Override
    public ResponseResult saveComment(@RequestBody CommentSaveDto dto) {
        return apCommentServiceI.saveComment(dto);
    }

    @PostMapping("like")
    @Override
    public ResponseResult likeComment(@RequestBody CommentLikeDto dto) {


        return apCommentServiceI.likeComment(dto);
    }

    @Override
    @PostMapping("load")
    public ResponseResult loadCommentList(@RequestBody CommentDto dto) {
        return apCommentServiceI.loadCommentList(dto);
    }
}
